<template>
	<view class="content">
		<view class="header-box">
			<view class="header" @click="goPath('/pages/user/userInfo/userInfo')">
				<view class="left"><image style="width: 120rpx;height: 120rpx;border-radius: 75rpx;" :src="userInfo.headImg" ></image></view>
				<view class="right">
					<view class="name">{{ userInfo.userName }}</view>
					<view class="tex">有效期限:{{adminInfo.overdueTime}}</view>
				</view>
			</view>
		</view>
		<view class="img1" @click="goPath('/pages/user/renew/renew')">续费</view>
		<view class="box">
			<view class="card">
				<view class="top">附件管理</view>
				<view class="bottom">
					<view class="cart-list-one" @tap="goPath('/pages/user/annex/annex')" style="margin-bottom: 0;">
						<image style="width: 60rpx;height: 60rpx;" src="../../static/image/111.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="top">大川长风</view>
				<view class="bottom">
					<view class="cart-list-one" v-for="item in menuList1" @tap="goPath1(item)">
						<view class="name1"><image style="width: 60rpx;height: 60rpx;":src="item.img" mode=""></image></view>
						<view class="count">{{ item.name }}</view>
					</view>
				</view>
			</view>
			<view class="card">
				<view class="top">微信官方服务</view>
				<view class="bottom">
					<view class="cart-list-one" v-for="item in menuList" @tap="goProgram(item)">
						<view class="name1"><image style="width: 48rpx;height: 48rpx;" :src="item.img" mode="widthFix"></image></view>
						<view class="count">{{ item.name }}</view>
					</view>
				</view>
			</view>
		</view>
		
		<view class="" style="">
			<about></about>
		</view>
	</view>
</template>

<script>
import {searchAdminUserById} from '../../utils/api.js';
export default {
	data() {
		return {
			userInfo: {},
			adminInfo:{},
			menuList1:[
				{
					id: 1,
					img: '../../static/image/222.png',
					name: '教学视频',
					path: '/pages/user/teachingVideo/teachingVideo'
				},
				{
					id: 2,
					img: '../../static/image/333.png',
					name: '版本信息',
					path: '/pages/user/versionInfo/versionInfo'
				},
				// {
				// 	id: 3,
				// 	img: '../../static/image/444.png',
				// 	name: '系统通知',
				// 	path: ''
				// },
			],
			menuList: [
				
				{
					id: 1,
					img: '../../static/image/555.png',
					name: 'web分析',
					path: '',
					appId:'wxbfda76c93d1cb61f'
				},
				{
					id: 2,
					img: '../../static/image/666.png',
					name: '支付助手',
					path: '',
					appId:'wx49625208931d29ec'
				},
				{
					id: 3,
					img: '../../static/image/777.png',
					name: '客服助手',
					path: '',
					appId:'wx277c9f1d194fce2f'
				},
				
				
				{
					id: 4,
					img: '../../static/image/888.png',
					name: '小程序助手',
					appId: 'wxcff7381e631cf54e'
				}
			]
		};
	},
	onLoad() {},

	onShow() {
		if (uni.getStorageSync('userInfo')) {
			this.userInfo = uni.getStorageSync('userInfo');
			this.getAdminInfo()
		} else {
			uni.showToast({
				icon: 'error',
				title: '登录失效'
			});
			setTimeout(() => {
				uni.navigateTo({
					url: '/pages/login/login'
				});
			}, 500);
		}
	},

	methods: {
		getAdminInfo(){
			let data={
				id:this.userInfo.id
			}
			searchAdminUserById(data).then(res=>{
				if(res.code==200){
					this.adminInfo=res.body
				}
			})
		},
		
		goUserinfo(path) {
			uni.navigateTo({
				url: '/pages/user/userInfo/userInfo'
			});
		},
		goPath(path){
				uni.navigateTo({
					url:path
				})
			
		},
		goPath1(item){
			uni.navigateTo({
				url:item.path
			})
		},
		goProgram(item){
			
					uni.navigateToMiniProgram({
					    appId:item.appId,
					    envVersion:"release",
					    success: res => {
					      // 打开成功
					      console.log("打开成功", res);
					    },
					    fail: err => {
					      console.log(err);
					    }
					});
				
			
		}
	}
};
</script>

<style lang="scss">
page {
	background: linear-gradient(-29deg, #f9f9f9 0%, #fbecf1 66%, #cee3fc 95%);
	// padding: 30rpx;
	// box-sizing: border-box;
}
.img1 {
	width: 150rpx;
	height: 50rpx;
	background: #D0DDFF;
	display: flex;
	justify-content: center;
	align-items: center;
	border-radius: 25rpx;
	position: absolute;
	top: 320rpx;
	right: 20rpx;
	color: #165DFF;
	font-size: 28rpx;
}


.header-box{
	height: 530rpx;
	background: linear-gradient(121deg, #1450E6 3%, #81A3F7 100%);
	padding:300rpx 20rpx 0 40rpx;
	box-sizing: border-box;
	.header {
		height: 150rpx;
		display: flex;
		align-items: center;
		.left {
			margin-right: 20rpx;
		}
		.right {
			color: #fff;
			.name {
				font-size: 32rpx;
				font-family: PingFang SC;
				font-weight: 700;
				margin-bottom: 26rpx;
			}
			.tex {
				font-size: 26rpx;
				font-family: Source Han Sans;
				font-weight: 500;
			}
		}
	}
}


.box{
	padding: 30rpx;
	.card {
		background: #fff;
		border-radius: 10rpx;
		padding: 26rpx 32rpx ;
		margin-bottom: 30rpx;
		.top {
			font-size: 32rpx;
			font-family: Source Han Sans;
			font-weight: 500;
			color: #000000;
		}
		.bottom {
			display: flex;
			align-items: center;
			flex-wrap: wrap;
			margin-top: 20rpx;
			.cart-list-one {
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;
				width: 156rpx;
				margin-bottom: 20rpx;
				.name1 {
					margin-bottom: 18rpx;
				}
				.count {
					font-size: 22rpx;
					font-family: Source Han Sans;
					font-weight: 350;
				}
			}
		}
	}
}

</style>
